<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>peach.nn.mem.Hopfield</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="peach-module.html">Package&nbsp;peach</a> ::
        <a href="peach.nn-module.html">Package&nbsp;nn</a> ::
        <a href="peach.nn.mem-module.html">Module&nbsp;mem</a> ::
        Class&nbsp;Hopfield
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="peach.nn.mem.Hopfield-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Hopfield</h1><p class="nomargin-top"><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_peach_nn_20" name="uml_class_diagram_for_peach_nn_20">
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#bias" title="True if the neuron is biased. Not writable." alt="" coords="107,31,247,49"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#phi" title="The activation function. It can be set with an Activation instance or a standard Python function. If a standard function is given, it must receive a real value and return a real value that is the activation value of the neuron. In that case, it is adjusted to work accordingly with the internals of the layer." alt="" coords="107,49,247,68"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#shape" title="Shape of the layer, given in the format of a tuple (m, n), where m is the number of neurons in the layer, and n is the number of inputs in each neuron. Not writable." alt="" coords="107,68,247,87"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#size" title="Number of neurons in the layer. Not writable." alt="" coords="107,87,247,105"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#v" title="The activation potential of the neuron. Not writable, and only available after the neuron is fed some input." alt="" coords="107,105,247,124"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#y" title="The activation value of the neuron. Not writable, and only available after the neuron is fed some input." alt="" coords="107,124,247,143"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#__getitem__" title="The [ ] get interface." alt="" coords="107,145,247,164"/>
<area shape="rect" id="node134" href="peach.nn.base.Layer-class.html#__setitem__" title="The [ ] set interface." alt="" coords="107,164,247,183"/>
<area shape="rect" id="node1" href="peach.nn.base.Layer-class.html" title="Base class for neural networks." alt="" coords="95,6,257,189"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#inputs" title="Number of inputs for each neuron in the layer. For a Hopfield model, there are as much inputs as there are neurons. Not writable." alt="" coords="17,233,337,252"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#weights" title="A numpy array containing the synaptic weights of the network. Each line is the weight vector of a neuron. It is writable, but the new weight array must be the same shape of the neuron, or an exception is raised." alt="" coords="17,252,337,271"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#__init__" title="Initializes the Hopfield network." alt="" coords="17,273,337,292"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#learn" title="Applies one example of the training set to the network." alt="" coords="17,292,337,311"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#train" title="Presents a training set to the network" alt="" coords="17,311,337,329"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#step" title="Performs a step in the recovering procedure" alt="" coords="17,329,337,348"/>
<area shape="rect" id="node133" href="peach.nn.mem.Hopfield-class.html#__call__" title="Recovers a stored pattern" alt="" coords="17,348,337,367"/>
<area shape="rect" id="node2" href="peach.nn.mem.Hopfield-class.html" title="Hopfield neural network model" alt="" coords="5,209,349,373"/>
</map>
  <img src="uml_class_diagram_for_peach_nn_20.gif" alt='' usemap="#uml_class_diagram_for_peach_nn_20" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<p>Hopfield neural network model</p>
<p>A Hopfield network is a recurrent network of one layer of neurons. There
output of every neuron is conected to the inputs of every other neuron, but
not to itself. This kind of network is autoassociative, or content-based
memory. That means that, given a noisy version of a pattern stored in it,
the network is capable of, through an iterative algorithm, recover the
original pattern, removing the noise. There is a limit in the quantity of
patterns that can be stored without causing error, and if a pattern is
stored, its negated form is also stored.</p>
<p>This is the binary form of the Hopfield network, which is the most common
form. It implements a <tt class="rst-docutils literal">Layer</tt> of neurons, without bias, and with the
Signum as the activation function.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">size</span>,
        <span class="summary-sig-arg">phi</span>=<span class="summary-sig-default">&lt;class 'peach.nn.af.Signum'&gt;</span>)</span><br />
      Initializes the Hopfield network.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__getinputs"></a><span class="summary-sig-name">__getinputs</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__getinputs">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__getweights"></a><span class="summary-sig-name">__getweights</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__getweights">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__setweights"></a><span class="summary-sig-name">__setweights</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">m</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__setweights">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#learn" class="summary-sig-name">learn</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">x</span>)</span><br />
      Applies one example of the training set to the network.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.learn">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#train" class="summary-sig-name">train</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">train_set</span>)</span><br />
      Presents a training set to the network</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.train">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#step" class="summary-sig-name">step</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">x</span>)</span><br />
      Performs a step in the recovering procedure</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.step">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#__call__" class="summary-sig-name">__call__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">imax</span>=<span class="summary-sig-default">2000</span>,
        <span class="summary-sig-arg">eqmax</span>=<span class="summary-sig-default">100</span>)</span><br />
      Recovers a stored pattern</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__call__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="peach.nn.base.Layer-class.html">base.Layer</a></code></b>:
      <code><a href="peach.nn.base.Layer-class.html#__getitem__">__getitem__</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#__setitem__">__setitem__</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__sizeof__</code>,
      <code>__str__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="peach.nn.mem.Hopfield-class.html#inputs" class="summary-name">inputs</a><br />
      Number of inputs for each neuron in the layer. For a Hopfield model,
there are as much inputs as there are neurons. Not writable.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="peach.nn.mem.Hopfield-class.html#weights" class="summary-name">weights</a><br />
      A <tt class="rst-docutils literal">numpy</tt> array containing the synaptic weights of the network. Each
line is the weight vector of a neuron. It is writable, but the new weight
array must be the same shape of the neuron, or an exception is raised.
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="peach.nn.base.Layer-class.html">base.Layer</a></code></b>:
      <code><a href="peach.nn.base.Layer-class.html#bias">bias</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#phi">phi</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#shape">shape</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#size">size</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#v">v</a></code>,
      <code><a href="peach.nn.base.Layer-class.html#y">y</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">size</span>,
        <span class="sig-arg">phi</span>=<span class="sig-default">&lt;class 'peach.nn.af.Signum'&gt;</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Initializes the Hopfield network.</p>
<p>The Hopfield network is implemented as a layer of neurons.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>size</code></strong> - The number of neurons in the network. In a Hopfield network, the
number of neurons is also the number of inputs in each neuron, and
the dimensionality of the patterns to be stored and recovered.</li>
        <li><strong class="pname"><code>phi</code></strong> - The activation function. Traditionally, the Hopfield network uses
the signum function as activation. This is the default value.</li>
    </ul></dd>
    <dt>Overrides:
        object.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="learn"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">learn</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">x</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.learn">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Applies one example of the training set to the network.</p>
<p>Training a Hopfield network is not exactly an iterative procedure. The
network usually stores a small number of patterns, and the learning
procedure consists only in computing the synaptic weight matrix, which
can be done in very few steps (in fact, just the number of patterns).
This method is here for consistency with the rest of the library, but
it works, anyway.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>x</code></strong> - The pattern to be stored. It must be a vector with the same size as
the network, or else an exception will be raised. The pattern can be
of any dimensionality, but it will internally be converted to a
column vector.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="train"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">train</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">train_set</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.train">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Presents a training set to the network</p>
<p>This method stores all the patterns of the training set in the weight
matrix. It calls the <tt class="rst-docutils literal">learn</tt> method for every pattern in the set.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>train_set</code></strong> - A list containing all the patterns to be stored in the network. Each
pattern is a vector of any dimensions, which are converted
internally to a column vector.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="step"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">step</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">x</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.step">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Performs a step in the recovering procedure</p>
<p>The algorithm for recovering the patterns stored in a Hopfield network
is an iterative algorithm which goes from a starting test pattern (a
stored pattern with noise) and recovers the noiseless version -- if
possible. This method takes the test pattern and performs one step of
the convergence</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>x</code></strong> - The noisy pattern.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>The result of one step of the convergence. This might be the same as
the input pattern, or the pattern with one component inverted.</dd>
  </dl>
</td></tr></table>
</div>
<a name="__call__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__call__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">x</span>,
        <span class="sig-arg">imax</span>=<span class="sig-default">2000</span>,
        <span class="sig-arg">eqmax</span>=<span class="sig-default">100</span>)</span>
    <br /><em class="fname">(Call operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.nn.mem-pysrc.html#Hopfield.__call__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Recovers a stored pattern</p>
<p>The <tt class="rst-docutils literal">__call__</tt> interface should be called if a memory needs to be
recovered from the network. Given a noisy pattern <tt class="rst-docutils literal">x</tt>, the algorithm
will be executed until convergence or a maximum number of iterations
occur. This method repeatedly calls the <tt class="rst-docutils literal">step</tt> method until a stop
condition is reached. The stop condition is the maximum number of
iterations, or a number of iterations where no changes are found in the
retrieved pattern.</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>x</code></strong> - The noisy pattern vector presented to the network.</li>
        <li><strong class="pname"><code>imax</code></strong> - The maximum number of iterations the algorithm is to be repeated.
When this number of iterations is reached, the algorithm will stop,
whether the pattern was found or not. Defaults to 2000.</li>
        <li><strong class="pname"><code>eqmax</code></strong> - The maximum number of iterations the algorithm will be repeated if
no changes occur in the retrieval of the pattern. At each iteration
of the algorithm, a component might change. It is considered that,
if a number of iterations are performed and no changes are found in
the pattern, then the algorithm converged, and it stops. Defaults to
100.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>The vector containing the recovered pattern from the stored memories.</dd>
    <dt>Overrides:
        <a href="peach.nn.base.Layer-class.html#__call__">base.Layer.__call__</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== PROPERTY DETAILS ==================== -->
<a name="section-PropertyDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Property Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-PropertyDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="inputs"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">inputs</h3>
  Number of inputs for each neuron in the layer. For a Hopfield model,
there are as much inputs as there are neurons. Not writable.
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#__getinputs" class="summary-sig-name" onclick="show_private();">__getinputs</a>(<span class="summary-sig-arg">self</span>)</span>
    </dd>
  </dl>
</td></tr></table>
</div>
<a name="weights"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">weights</h3>
  A <tt class="rst-rst-docutils literal rst-docutils literal">numpy</tt> array containing the synaptic weights of the network. Each
line is the weight vector of a neuron. It is writable, but the new weight
array must be the same shape of the neuron, or an exception is raised.
  <dl class="fields">
    <dt>Get Method:</dt>
    <dd class="value"><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#__getweights" class="summary-sig-name" onclick="show_private();">__getweights</a>(<span class="summary-sig-arg">self</span>)</span>
    </dd>
    <dt>Set Method:</dt>
    <dd class="value"><span class="summary-sig"><a href="peach.nn.mem.Hopfield-class.html#__setweights" class="summary-sig-name" onclick="show_private();">__setweights</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">m</span>)</span>
    </dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Jul 31 16:59:41 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
